//
//  DYAPI.m
//  Pods
//
//  Created by LXF on 16/6/30.
//
//

#import "DYAPI.h"
#import "XXJSONRequestSerializer.h"
#import "XXJSONResponseSerializer.h"
#import "DYLibraryConfig.h"

@implementation DYAPI

+(instancetype)shared{
    static DYAPI *instance;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        
        instance = [[self alloc]initWithBaseURL:[NSURL URLWithString:[DYLibraryConfig shared].baseURL]];
        
        instance.requestSerializer = [XXJSONRequestSerializer serializer];
        instance.requestSerializer.timeoutInterval = 5;
        
        instance.responseSerializer = [XXJSONResponseSerializer serializer];
        instance.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript",@"text/html", nil];
        
    });
    return instance;
}

@end
